package 华为测试;

import java.util.Scanner;

/**
 * Created by hest0 on 2017/7/10.
 */
public class 进制转换 {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        while (sc.hasNext()) {
            //转化成16进制转换成10进制
            String s = sc.nextLine().substring(2);
            int dec = Integer.parseInt(s, 16);
            System.out.println(dec);

            //十进制转化成2进制
            String s1 = sc.nextLine();
            int n = Integer.parseInt(s1);
            System.out.println(Integer.toBinaryString(n));
        }
        sc.close();
    }

}
